﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using BaseObj;

/// <summary>
/// BasePage 的摘要说明
/// </summary>
public class BasePage:System.Web.UI.Page
{
    protected string errorPage = "../error.htm";

   

    protected User user;

    protected void Page_Load(object sender, EventArgs e)
    {

    }

    /// <summary>
    /// 获取用户Id
    /// </summary>
    private string GetUserId()
    {
        if (Page.Session["UserId"] != null)
        {
            return Page.Session["UserId"].ToString();
        }
        else
        {
            return "";
        }
    }

    #region 重写方法

    override protected void OnLoad(EventArgs e)
    {
        //初始化用户对象：
        this.user = new User(this.GetUserId());
        if (!this.user.IsEffective)
        {
            //if(this.user.Roles[0].Resources[0].ResourceName==)
            this.Response.Write("<script>javascript:alert(\"用户信息已经过期！\");window.location.href=\""+this.errorPage+"\";</script>");
        }
        base.OnLoad(e);
    }
    override protected void OnInit(EventArgs e)
    {
        base.OnInit(e);
    }
    #endregion
}
